﻿using System;
using System.Collections.Generic;
using System.Text;
using GD.ModelContest.DataAccess;
using GD.ModelContest.Model;

namespace GD.ModelContest.Service.Impl
{
    public class UserServiceImpl : IUserService
    {
        private IUserDao infoDao;

        public UserServiceImpl(IUserDao infoDao)
        {
            this.infoDao = infoDao;
        }

        #region mc_user对象

        public bool InsertUser(mc_user user)
        {
            return infoDao.InsertUser(user);
        }

        public bool UpdateUser(mc_user user)
        {
            return infoDao.UpdateUser(user);
        }

        public bool DeleteUser(int userId)
        {
            return infoDao.DeleteUser(userId);
        }

        public mc_user GetUserById(int userId)
        {
            return infoDao.GetUserById(userId);    
        }

        public mc_user GetUserLogin(string email, string pwd)
        {
            return infoDao.GetUserLogin(email, pwd);
        }

        public int IsEmailAlreadyExisted(string email)
        {
            return infoDao.IsEmailAlreadyExisted(email);
        }

        public IList<mc_user> GetUserCollection(string name, string sex, string items, string bodyHeight, string bodyWeight, string bloodType, string city, int pageIndex, int pageSize, ref int count)
        {
            return infoDao.GetUserCollection(name, sex, items, bodyHeight, bodyWeight, bloodType, city, pageIndex, pageSize, ref count);
        }

        #endregion

        #region mc_photo对象

        public bool InsertPhoto(mc_photo photo)
        {
            return infoDao.InsertPhoto(photo);
        }

        public bool UpdatePhoto(mc_photo photo)
        {
            return infoDao.UpdatePhoto(photo);
        }

        public bool DeletePhoto(int photoId)
        {
            return infoDao.DeletePhoto(photoId);
        }
		
		public mc_photo GetHeadPhotoByUserId(int userId)
        {
            return infoDao.GetHeadPhotoByUserId(userId);
        }

        public IList<mc_photo> GetPhotoCollection(int userId)
        {
            return infoDao.GetPhotoCollection(userId);
        }

        #endregion

        #region mc_video对象

        public bool InsertVideo(mc_video video)
        {
            return infoDao.InsertVideo(video);
        }

        public bool UpdateVideo(mc_video video)
        {
            return infoDao.UpdateVideo(video);
        }

        public bool DeleteVideo(int videoId)
        {
            return infoDao.DeleteVideo(videoId);
        }

        public IList<mc_video> GetVideoCollection(int userId)
        {
            return infoDao.GetVideoCollection(userId);
        }

        #endregion

        #region mc_vote对象

        public bool InsertVote(mc_vote vote)
        {
            return infoDao.InsertVote(vote);
        }

        public bool UpdateVote(mc_vote vote)
        {
            return infoDao.UpdateVote(vote);
        }

        public bool DeleteVote(int voteId)
        {
            return infoDao.DeleteVote(voteId);
        }

        public mc_vote GetVoteByUserId(int userId)
        {
            return infoDao.GetVoteByUserId(userId);
        }

        #endregion

        #region mc_ip 对象

        public bool InsertIp(mc_ip ip)
        {
            return infoDao.InsertIp(ip);
        }

        public bool UpdateIp(mc_ip ip)
        {
            return infoDao.UpdateIp(ip);
        }

        public bool DeleteIp(int ipId)
        {
            return infoDao.DeleteIp(ipId);
        }

        public mc_ip GetIpByTime(string ip,string startTime, string endTime)
        {
            return infoDao.GetIpByTime(ip, startTime, endTime);
        }

        public int GetIp(string ip)
        {
            return infoDao.GetIp(ip);
        }

        #endregion
    }
}
